@model IEnumerable<LetLord.Models.Tenant>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            UserName
        </th>
        <th>
            FirstName
        </th>
        <th>
            LastName
        </th>
        <th>
            Email
        </th>
        <th>
            AccountType
        </th>
        <th>
            TenantAge
        </th>
        <th>
            PersonalDescription
        </th>
        <th>
            MinBudget
        </th>
        <th>
            MaxBudget
        </th>
        <th>
            IsProfessional
        </th>
        <th>
            IsStudent
        </th>
        <th>
            HasChildren
        </th>
        <th>
            HasRentAllowance
        </th>
        <th>
            IsInGroup
        </th>
        <th>
            DateWantToRentFrom
        </th>
        <th>
            DateWantToRentTo
        </th>
        <th>
            DesiredPropertyLocation
        </th>
        <th>
            TenantProfileViews
        </th>
        <th>
            ReferencePhotos
        </th>
        <th>
            TenantGroupMembers
        </th>
        <th>
            Viewings
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.UserId }) |
            @Html.ActionLink("Details", "Details", new { id=item.UserId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.UserId })
        </td>
        <td>
			@item.UserName
        </td>
        <td>
			@item.FirstName
        </td>
        <td>
			@item.LastName
        </td>
        <td>
			@item.Email
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.AccountType).ToString()
        </td>
        <td>
			@item.TenantAge
        </td>
        <td>
			@item.PersonalDescription
        </td>
        <td>
			@String.Format("{0:F}", item.MinBudget)
        </td>
        <td>
			@String.Format("{0:F}", item.MaxBudget)
        </td>
        <td>
			@item.IsProfessional
        </td>
        <td>
			@item.IsStudent
        </td>
        <td>
			@item.HasChildren
        </td>
        <td>
			@item.HasRentAllowance
        </td>
        <td>
			@item.IsInGroup
        </td>
        <td>
			@String.Format("{0:g}", item.DateWantToRentFrom)
        </td>
        <td>
			@String.Format("{0:g}", item.DateWantToRentTo)
        </td>
        <td>
			@item.DesiredPropertyLocation
        </td>
        @*<td>
			@item.TenantProfileViews
        </td>*@
        <td>
			@(item.ReferencePhotos == null ? "None" : item.ReferencePhotos.Count.ToString())
        </td>
        <td>
			@(item.TenantGroupMembers == null ? "None" : item.TenantGroupMembers.Count.ToString())
        </td>
        <td>
			@(item.Viewings == null ? "None" : item.Viewings.Count.ToString())
        </td>
    </tr>
}

</table>


